<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge，chrome=1">
    <meta name="renderer" content="webkit">
    <script src="../../../node_modules/jquery/dist/jquery.min.js"></script>
    <link rel="stylesheet" href="../../../node_modules/bootstrap/dist/css/bootstrap.min.css">
    <script src="../../../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="../../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
    <script src="../../../node_modules/vue/dist/vue.min.js"></script>
    <link rel="stylesheet" href="../../../node_modules/element-ui/lib/theme-chalk/index.css">
    <script src="../../../node_modules/element-ui/lib/index.js"></script>


    <!-- 自定义 -->
    <script src="../../../node_modules/mockjs/dist/mock.js"></script>
    <script src="../static/js/mock_config.js"></script>
    <script src="../static/js/index.js"></script>
    <link rel="stylesheet" href="../../index.css">

    <!-- PC -->
    <link rel="stylesheet" href="../static/css/task.css" media="only screen and (max-height:1600px) ">
    <!-- 手机App
    <link rel="stylesheet" href="../static/css/ProduceApp.css" media="only screen and (min-height:1600px) "> -->
</head>

<body>
    <!--主体-->
    <div class="main clearfix" id="app">
        <div class="header">
            <header>
                <div class="navbar">
                    <div class="card_T">
                        <div class="card A" style="background-color:#0b87fa;color: white;">
                            <ul class="header-text">
                                <li>
                                    <h8 style="line-height: 78px;">生产任务追踪看板</h8>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="pc_content">
                        <div class="card_header">
                            <div class="card C" style="background-color: #33814e;">
                                <ul class="list-group list-group-flush">
                                    <li class="list-group-item">
                                        <h4>生产任务</h4>
                                    </li>
                                    <li class="list-group-item1">
                                        <h3 id="WaitPrtQty">{{defaultDt1.length}}条</h3>
                                    </li>
                                </ul>
                            </div>
                            <div class="card C" style=" background: #33814e;">
                                <ul class="list-group list-group-flush">
                                    <li class="list-group-item">
                                        <h4>注塑单品</h4>
                                    </li>
                                    <li class="list-group-item1">
                                        <h3 id="Waitcompleted">{{zs}}条</h3>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="card_header">
                            <div class="card C" style="background:#33814e;">
                                <ul class="list-group list-group-flush">
                                    <li class="list-group-item">
                                        <h4>组装品</h4>
                                    </li>
                                    <li class="list-group-item1">
                                        <h3 id="Col8Qty1">{{zz}}条</h3>
                                    </li>
                                </ul>
                            </div>
                            <div class="card C B" style="background:#FF0000;">
                                <ul class="list-group list-group-flush">
                                    <li class="list-group-item">
                                        <h4>任务逾期</h4>
                                    </li>
                                    <li class="list-group-item1">
                                        <h3 id="Col9Qty1">{{yu}}条</h3>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </header>
        </div>


        <div class="main-left">
            <div class="border-container">
                <div>
                    <el-table class="aa" :data="defaultDt1" :default-sort="{prop: 'date', order: 'descending'}" stripe="true" ref="defaultDt1" :height=el_table_height1>
                        <el-table-column type="index" width="50" label="NO">
                        </el-table-column>
                        <el-table-column prop="GoodsName" align="center" label="产品名称">
                        </el-table-column>
                        <el-table-column prop="GoodsSortName" align="center" label="产品类型">
                        </el-table-column>
                        <el-table-column prop="PP" align="center"  label="任务单号">
                        </el-table-column>
                        <el-table-column prop="PATaskQty" align="center" label="任务数">
                        </el-table-column>
                        <el-table-column prop="QtyInStor" align="center" label="入库数">
                        </el-table-column>
                        <el-table-column prop="MkCode" align="center" label="小微">
                        </el-table-column>
                        <el-table-column prop="FactoryCode" align="center"  label="机台">
                        </el-table-column>
                        <el-table-column prop="OrigBeginDate" align="center" label="原计划开始日">
                        </el-table-column>
                        <el-table-column prop="BeginDate" align="center" label="任务开始日">
                        </el-table-column>
                        <el-table-column prop="endDate" align="center" label="任务完工日">
                        </el-table-column>
                        <el-table-column  align="center"  label="任务逾期状态">
                            <template slot-scope="scope">
                                <div v-html="Days(scope)">
                                </div>
                            </template>
                        </el-table-column>
                    </el-table>
                </div>
                <span class="top-left border-span"></span>
                <span class="top-right border-span"></span>
                <span class="bottom-left border-span"></span>
                <span class="bottom-right border-span"></span>
            </div>
        </div>
    </div>

</body>

<script>
    new Vue({
        el: '#app',
        data() {
            return {
                el_table_height1: 900,
                defaultDt1: [],
                zs:0,
                zz:0,
                yu:0
            }
        },
        methods: {
            GetTabelDate(that) {
                // 生产任务追踪看板
                GetCodeData("VB22032916481846", "Get", "Goods").then(function(res) {
                        that.defaultDt1 = res.rows;
                        that.zs = 0;
                        that.zz = 0;
                        that.yu = 0;
                        res.rows.forEach(element => {
                            if(element.GoodsSortName == "注塑单品"){
                                that.zs++;
                            }else if(element.GoodsSortName == "组装品"){
                                that.zz++;
                            }
                            if(element.Stauts == "close"){
                                that.yu++;
                            }
                        });
                    })
            },
            Days(cellValue) {
                let _html = "";
                if (cellValue) {
                    _html += "<div>"
                    var _width1 = 100;
                    var _color = "";
                    _width1 = cellValue.row.ShowText + cellValue.row.Days;
                    if (_width1 > 100) {
                        _width1 = 100;
                    }
                    if (cellValue.row.Stauts == 'open') {
                        _color = "#00a000";
                    } else if (cellValue.row.Stauts == 'close') {
                        _color = "#FF0000";
                    } else {
                        _color = "#008000";
                    }
                    if (cellValue.row.Stauts == 'open' || cellValue.row.Stauts == 'close') {
                        _html += ("<div  style='border-radius:15px;position: relative; width:65px;padding: 0px;background:#4199fe;overflow: hidden;height:28px;'><div style='border-radius:15px;width: 100%; display: block; position: relative; background: " + _color + "; color: #000; height: 40px; line-height: 40px;'>" +
                            "</div>" +
                            "<div style='border-radius:15px;position:absolute;width:100%;height:100%;top:0;display:flex;align-items:center;justify-content:center;color:white;font-size: 16px;'>" + cellValue.row.ShowText + cellValue.row.Days +"天" +"</div>" +
                            "</div>" +
                            "");
                    }else {
                        _html += (cellValue.row.Days +"</div>" +
                            "");
                    }

                    return _html;
                }
            },
        },

        mounted() {
            TableAotoRoll([this.$refs.defaultDt1])
            var that = this
            setTimeout(function() {
                that.GetTabelDate(that)
            }, 0);
            setInterval(function() {
                 that.GetTabelDate(that)
            }, 1000 * 60);
        }
    })
</script>



</html>